﻿using System.Collections.Generic;
using System.Linq;

namespace FadeLang.CstVisitor
{
    internal class NameListVisitor : FadeLangBaseVisitor<List<string>>
    {
        private static NameListVisitor instance;
        public static NameListVisitor Instance => instance ?? (instance = new NameListVisitor());

        public override List<string> VisitNamelist(FadeLangParser.NamelistContext context) {
            if (context == null) {
                return new List<string>();
            }
            var names = context.NAME();
            return names.Select(name => name.GetText()).ToList();
        }
    }
}